Video encoders encode a sequence of video images (e.g., video frames) by using a variety of encoding schemes. Video encoding schemes typically interblock or intrablock encode video frames or macroblocks within the video frames (where a macroblock is a 16×16 set of pixels in a video frame). An intrablock encoded frame or macroblock is one that is encoded independently of other frames or macroblocks in other frames. An interblock encoded frame or macroblock is one that is encoded by reference to one or more other frames or macroblocks in other frames.
When compressing video frames, some encoders implement a ‘rate controller,’ which provides a ‘bit budget’ for a video frame or a set of video frames that are to be encoded. The bit budget specifies the number of bits that have been allocated to encode the video frame or set of video frames. By efficiently allocating the bit budgets, the rate controller attempts to generate the highest quality compressed video stream in view of certain constraints (e.g., a target bit rate, etc.).
To date, a variety of single-pass and multi-pass rate controllers have been proposed. A single-pass rate controller provides bit budgets for an encoding scheme that encodes a series of video images in one pass, whereas a multi-pass rate controller provides bit budgets for an encoding scheme that encodes a series of video images in multiple passes.
Multi-pass rate controllers optimize the encoding for a particular bit rate based on a set of constraints. Single-pass rate controllers, on the other hand, are suitable for many applications (e.g., real-time encoding applications) that are not typically well suited for multi-pass encoding.
Prior single-pass rate controllers do not typically consider the spatial or temporal complexity of frames or pixel-sets within the frames in controlling the bit rates of their encodings. Also, prior single-pass rate controllers often do not estimate allocation of bits to future frames while allocating bits to a current frame. In addition, these rate controllers typically do not roll over unused bits allocations from prior frames to future frames. Prior single-pass rate controllers also assign bits to blocks of frames, without adaptively modifying the sizes of the blocks to the bit allocation. Therefore, there is a need in the art for an adaptive, single-pass rate controller that can achieve superior encoding results by flexibly accounting for a variety of conditions during the encoding.